package com.linkhub.oms.admin.config.forest.interceptor;

import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.interceptor.Interceptor;
import com.linkhub.oms.common.exception.BizException;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description: ForestExceptionInterceptor
 * @Author: echo
 * @Date: 2024/3/21 17:13
 * @Version: 1.0
 */
@Slf4j
public class ForestExceptionInterceptor implements Interceptor<ForestResponse<?>> {

    @Override
    public void afterExecute(ForestRequest request, ForestResponse response) {
        // 请求发生异常：网络超时等
        if (!response.noException()) {
            throw new BizException(response.getException().getMessage());
        }



    }
}
